Optimal. Leaf size=121 \[ \frac {2 b \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b} (b c-a d) f}-\frac {2 d \tanh ^{-1}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{\sqrt {c-d} \sqrt {c+d} (b c-a d) f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.19, antiderivative size = 121, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 4, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.129, Rules used = {4073, 3080,
2738, 214} \begin {gather*} \frac {2 b \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{f \sqrt {a-b} \sqrt {a+b} (b c-a d)}-\frac {2 d \tanh ^{-1}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{f \sqrt {c-d} \sqrt {c+d} (b c-a d)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3080
Rule 4073
Rubi steps
\begin {align*} \int \frac {\sec (e+f x)}{(a+b \sec (e+f x)) (c+d \sec (e+f x))} \, dx &=\int \frac {\cos (e+f x)}{(b+a \cos (e+f x)) (d+c \cos (e+f x))} \, dx\\ &=\frac {b \int \frac {1}{b+a \cos (e+f x)} \, dx}{b c-a d}-\frac {d \int \frac {1}{d+c \cos (e+f x)} \, dx}{b c-a d}\\ &=\frac {(2 b) \text {Subst}\left (\int \frac {1}{a+b+(-a+b) x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{(b c-a d) f}-\frac {(2 d) \text {Subst}\left (\int \frac {1}{c+d+(-c+d) x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{(b c-a d) f}\\ &=\frac {2 b \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b} (b c-a d) f}-\frac {2 d \tanh ^{-1}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{\sqrt {c-d} \sqrt {c+d} (b c-a d) f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.23, size = 119, normalized size = 0.98 \begin {gather*} -\frac {2 b \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} (b c-a d) f}-\frac {2 d \tanh ^{-1}\left (\frac {(-c+d) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{(-b c+a d) \sqrt {c^2-d^2} f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.47, size = 108, normalized size = 0.89
method | result | size |
derivativedivides | \(\frac {\frac {2 d \arctanh \left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (a d -b c \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}-\frac {2 b \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a d -b c \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}}{f}\) | \(108\) |
default | \(\frac {\frac {2 d \arctanh \left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (a d -b c \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}-\frac {2 b \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a d -b c \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}}{f}\) | \(108\) |
risch | \(\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right )}{\sqrt {c^{2}-d^{2}}\, \left (a d -b c \right ) f}-\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i c^{2}+i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{c \sqrt {c^{2}-d^{2}}}\right )}{\sqrt {c^{2}-d^{2}}\, \left (a d -b c \right ) f}+\frac {b \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a d -b c \right ) f}-\frac {b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a d -b c \right ) f}\) | \(318\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 5.02, size = 1072, normalized size = 8.86 \begin {gather*} \left [-\frac {{\left (a^{2} - b^{2}\right )} \sqrt {c^{2} - d^{2}} d \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) + {\left (b c^{2} - b d^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (f x + e\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (f x + e\right ) + a\right )} \sin \left (f x + e\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (f x + e\right )^{2} + 2 \, a b \cos \left (f x + e\right ) + b^{2}}\right )}{2 \, {\left ({\left (a^{2} b - b^{3}\right )} c^{3} - {\left (a^{3} - a b^{2}\right )} c^{2} d - {\left (a^{2} b - b^{3}\right )} c d^{2} + {\left (a^{3} - a b^{2}\right )} d^{3}\right )} f}, -\frac {{\left (a^{2} - b^{2}\right )} \sqrt {c^{2} - d^{2}} d \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) - 2 \, {\left (b c^{2} - b d^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (f x + e\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (f x + e\right )}\right )}{2 \, {\left ({\left (a^{2} b - b^{3}\right )} c^{3} - {\left (a^{3} - a b^{2}\right )} c^{2} d - {\left (a^{2} b - b^{3}\right )} c d^{2} + {\left (a^{3} - a b^{2}\right )} d^{3}\right )} f}, -\frac {2 \, {\left (a^{2} - b^{2}\right )} \sqrt {-c^{2} + d^{2}} d \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) + {\left (b c^{2} - b d^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (f x + e\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (f x + e\right ) + a\right )} \sin \left (f x + e\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (f x + e\right )^{2} + 2 \, a b \cos \left (f x + e\right ) + b^{2}}\right )}{2 \, {\left ({\left (a^{2} b - b^{3}\right )} c^{3} - {\left (a^{3} - a b^{2}\right )} c^{2} d - {\left (a^{2} b - b^{3}\right )} c d^{2} + {\left (a^{3} - a b^{2}\right )} d^{3}\right )} f}, -\frac {{\left (a^{2} - b^{2}\right )} \sqrt {-c^{2} + d^{2}} d \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) - {\left (b c^{2} - b d^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (f x + e\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (f x + e\right )}\right )}{{\left ({\left (a^{2} b - b^{3}\right )} c^{3} - {\left (a^{3} - a b^{2}\right )} c^{2} d - {\left (a^{2} b - b^{3}\right )} c d^{2} + {\left (a^{3} - a b^{2}\right )} d^{3}\right )} f}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (e + f x \right )}}{\left (a + b \sec {\left (e + f x \right )}\right ) \left (c + d \sec {\left (e + f x \right )}\right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 522 vs.
\(2 (103) = 206\).
time = 0.58, size = 522, normalized size = 4.31 \begin {gather*} \frac {\frac {{\left (\sqrt {-c^{2} + d^{2}} b {\left (c - 2 \, d\right )} {\left | c - d \right |} + \sqrt {-c^{2} + d^{2}} a d {\left | c - d \right |} + \sqrt {-c^{2} + d^{2}} {\left | -b c + a d \right |} {\left | c - d \right |}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-\frac {2 \, a c - 2 \, b d + \sqrt {-4 \, {\left (a c + b c + a d + b d\right )} {\left (a c - b c - a d + b d\right )} + 4 \, {\left (a c - b d\right )}^{2}}}{a c - b c - a d + b d}}}\right )\right )}}{{\left (b c - a d\right )}^{2} {\left (c^{2} - 2 \, c d + d^{2}\right )} + {\left (c^{3} - 2 \, c^{2} d + c d^{2}\right )} a {\left | -b c + a d \right |} - {\left (c^{2} d - 2 \, c d^{2} + d^{3}\right )} b {\left | -b c + a d \right |}} + \frac {{\left (\sqrt {-a^{2} + b^{2}} b c {\left | a - b \right |} + \sqrt {-a^{2} + b^{2}} {\left (a - 2 \, b\right )} d {\left | a - b \right |} - \sqrt {-a^{2} + b^{2}} {\left | -b c + a d \right |} {\left | a - b \right |}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-\frac {2 \, a c - 2 \, b d - \sqrt {-4 \, {\left (a c + b c + a d + b d\right )} {\left (a c - b c - a d + b d\right )} + 4 \, {\left (a c - b d\right )}^{2}}}{a c - b c - a d + b d}}}\right )\right )}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} {\left (b c - a d\right )}^{2} - {\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} c {\left | -b c + a d \right |} + {\left (a^{2} b - 2 \, a b^{2} + b^{3}\right )} d {\left | -b c + a d \right |}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.36, size = 2665, normalized size = 22.02 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________